import config
import page
import utils
from base.base import Base

log = utils.Logger(config.base_dir + '/log/all.log', level='info')

class PageOrder(Base):
    # 回到首页
    def page_click_index(self):
        self.base_home_page(page.shop_home_page)

    # 点击我的购物车
    def page_click_cart(self):
        self.base_find_element(page.order_click_cart).click()

    # 全选框点击
    def page_order_all_click(self):
        self.base_click_element(page.order_check_all)

    # 去结算
    def page_order_go_money(self):
        self.base_click_element(page.order_go_account)

    # 选择收货人
    def page_order_select_address(self):
        self.base_click_element(page.order_select_address)

    # 去结算
    def page_order_go_two_money(self):
        self.base_click_element(page.order_submit_goods)

    # 获取文本信息
    def page_get_text(self):
        log.logger.info("文本信息为:{}".format(self.base_get_text(page.order_text)))
        return self.base_get_text(page.order_text)

    # 组合业务
    def order_all(self):
        self.page_click_cart()
        self.page_order_all_click()
        self.page_order_go_money()
        self.page_order_select_address()
        self.page_order_go_two_money()
